package com.mjt.protal.web.controller;

import com.mjt.dongbao.common.base.annotation.TokenCheck;
import com.mjt.dongbao.common.base.result.ResultWrapper;
import com.mjt.dongbao.ums.entity.UmsMember;
import com.mjt.dongbao.ums.entity.dto.UmsMemberLoginParamDto;
import com.mjt.dongbao.ums.entity.dto.UmsMemberRegisterParamDTO;
import com.mjt.dongbao.ums.service.UmsMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description
 * @Author mjt
 * @Time 2022/1/13
 */

/**
 *
 * @Description: 用户模块接口层
 * @Author mjt
 * @Date 2022/1/13
 */
@RestController()
@RequestMapping("/umsMember")
public class UmsMemberController {

    @Autowired
    UmsMemberService umsMemberService;

    /**
     *
     * @Description: 用户注册接口
     * @Author mjt
     * @Date 2022/1/13
     */
    @PostMapping("/register")
    public ResultWrapper userRegister(@RequestBody @Validated UmsMemberRegisterParamDTO umsMemberRegisterParamDTO){
        return umsMemberService.register(umsMemberRegisterParamDTO);
    }

    /**
     *
     * @Description: 用户登录接口
     * @Author mjt
     * @Date 2022/1/13
     */
    @PostMapping("/login")
    public ResultWrapper userLogin(@RequestBody @Validated UmsMemberLoginParamDto umsMemberLoginParamDto){
        return umsMemberService.login(umsMemberLoginParamDto);
    }

    /**
     *
     * @Description: 用户修改个人信息接口
     * @Author mjt
     * @Date 2022/1/13
     */
    @PostMapping("/edit")
    @TokenCheck
    public ResultWrapper userEdit(UmsMember umsMember){
        System.out.println("正常业务逻辑处理");
        return umsMemberService.edit(umsMember);
    }

}
